package com.jerry.api.service.impl;

import com.jerry.api.entity.*;
import com.jerry.api.mapper.JStudentMapper;
import com.jerry.api.service.JStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Date: 2025/4/7 14:59
 * @Created: by 王永发
 * @Description: ScoreServiceImpl
 */

@Service
public class JStudentServiceImpl implements JStudentService {

    @Autowired
    JStudentMapper studentMapper;

    @Override
    public String getStudentNumber(String grade) {
        return studentMapper.getStudentNumber(grade);
    }

    @Override
    public List<JGenderNumber> getGenderNumber(String grade) {
        return studentMapper.getGenderNumber(grade);
    }

    @Override
    public List<JMajor> getMajor() {
        return studentMapper.getMajor();
    }

    @Override
    public List<Map<String, Object>> getPeopleTotal(String year, String collage) {
        String yearStr = year;
        int thisYear = Integer.parseInt(yearStr);
        int lastYear = thisYear - 1;

        Map<String, Object> params = new HashMap<>();
        params.put("collage", collage);
        params.put("thisYear", thisYear);
        params.put("lastYear", lastYear);

        return studentMapper.getPeopleTotal(params);
    }

    @Override
    public List<JYearMajor> getYearMajor(String year) {
        return studentMapper.getYearMajor(year);
    }

    @Override
    public List<JMajorDiff> getMajorDiff(String year) {
        return studentMapper.getMajorDiff(year);
    }

    @Override
    public List<JProGenderCount> getProGenderCount(String year) {
        return studentMapper.getProGenderCount(year);
    }
}
